import { NameAction, GET, SET } from "./actionCreater";
interface STATE {
  name: string;
}
const defaultState: STATE = {
  name: "React",
};
const reducer = (state = defaultState, action: NameAction) => {
  switch (action.type) {
    case GET:
      return state;
    case SET:
      return { ...state, name: action.payload };
    default:
      return state;
  }
};
export default reducer;
